package wowraidmanager.client.wishlist;

import wowraidmanager.client.service.wishlist.UserStatusService;
import wowraidmanager.client.service.wishlist.UserStatusServiceAsync;
import wowraidmanager.shared.model.wishlist.UserStatus;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.RootPanel;

public class WishlistEntryPoint implements EntryPoint{

    protected UserStatusServiceAsync userStatusService = GWT.create(UserStatusService.class);

    public void onModuleLoad(){
        userStatusService.getUserStatus(new AsyncCallback<UserStatus>(){

            public void onSuccess(UserStatus result){
                if(result.isAdmin() || result.isUser()){
                    RootPanel.get().add(new Index(result));
                }else{
                    RootPanel.get().add(new NotMember(result));
                }
            }

            public void onFailure(Throwable caught){
            }
        });
    }

}
